package com.lancoo.ccas53.controller;

import com.lancoo.ccas53.pojo.vo.SelectedCourseStatistics;
import com.lancoo.ccas53.pojo.vo.StudentTeachingClass;
import com.lancoo.ccas53.service.StudentService;
import com.lancoo.ccas53.service.mobileService.MobileStudentService;
import com.lancoo.ccas53.util.ResponseObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: mabolin
 * @Date: 2024-07-12-16:19
 * @Description:
 */
@Api(tags = "移动端选课")
@RestController
//@RequestMapping("/api/v5.3/mobile/selectCourse")
@RequestMapping("mobile")
public class MobileSelectCourseController {
    @Autowired
    private MobileStudentService mobileStudentService;
    @Resource
    private StudentService studentService;

    @ApiOperation("获取课程详情")
    @GetMapping(value = "/getCourseDetail")
    public ResponseObject<StudentTeachingClass> getCourseDetail(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                                                @ApiParam(value = "学生id ", required = true) @RequestParam Long studentId,
                                                                @ApiParam(value = "0无需选课 1在线选课;2:分级教学 3:预选教学班", required = true) @RequestParam Integer teachingClassType,
                                                                @ApiParam(value = "教学班id", required = true) @RequestParam Long teachingClassId) {
        return ResponseObject.ofSuccess(mobileStudentService.getCourseDetail(taskId, studentId, teachingClassType, teachingClassId));
    }

    @ApiOperation("获取学生选课统计情况")
    @GetMapping(value = "/getStudentSelectedCourseStatistics")
    public ResponseObject<SelectedCourseStatistics> getStudentSelectedCourseStatistics(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                                                                       @ApiParam(value = "学生id ", required = true) @RequestParam Long studentId,
                                                                                       @ApiParam(value = "0无需选课 1在线选课;2:分级教学 3:预选教学班", required = true) @RequestParam Integer teachingClassType) {
        return ResponseObject.ofSuccess(mobileStudentService.getStudentSelectedCourseStatisticsByStudentId(taskId, studentId, teachingClassType));
    }

    @ApiOperation("获取学生课表")
    @GetMapping(value = "/getStudentCourseTimetable")
    public ResponseObject<List<StudentTeachingClass>> getStudentCourseTimetable(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                                                                @ApiParam(value = "学生id ", required = true) @RequestParam Long studentId) {
        return ResponseObject.ofSuccess(studentService.getSelectedByStudentId(taskId, studentId, 1));
    }

//    @ApiOperation("获取选课要求")
//    @GetMapping(value = "/getSelectionRequire")
//    public ResponseObject<SelectionRequireVo> getSelectionRequire(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
//                                                                  @ApiParam(value = "学生id ", required = true) @RequestParam Long studentId,
//                                                                  @ApiParam(value = "修读性质：1主修2辅修", required = true) @RequestParam(required = true) Integer studyNature) {
//        return ResponseObject.ofSuccess(studentService.getSelectionRequire(taskId, studentId, studyNature));
//    }

}
